//
//  ViewController.m
//  FileSystemDemo
//
//  Created by 周文成 on 2018/1/5.
//  Copyright © 2018年 C-LOVE. All rights reserved.
//

#import "ViewController.h"
#import "CLFileInfo.h"

#import "FileController.h"
#import "SystemFilePath.h"
#import "CLFile.h"

@interface ViewController ()



@end


@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    NSLog(@"---=-=--");
}




- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
    [super touchesBegan:touches withEvent:event];
    
    NSString *homePath = [SystemFilePath homePath];
    
    NSLog(@"homePath:%@", homePath);
    
    NSFileManager *fileManager = [NSFileManager defaultManager];
    
//    NSArray *subPaths = [fileManager subpathsOfDirectoryAtPath:homePath error:nil];
    NSArray *subPaths = [fileManager contentsOfDirectoryAtPath:homePath error:nil];
    
    NSArray *filePaths = [homePath stringsByAppendingPaths:subPaths];
    
    NSMutableArray *arrayM = [[NSMutableArray alloc] init];
    for (NSString *filePath in filePaths) {
        CLFile *file = [[CLFile alloc] initWithFilePath:filePath];
        [arrayM addObject:file];
    }
    
    FileController *fileController = [[FileController alloc] init];
//    fileController.files = arrayM;
    fileController.currentFilePath = homePath;
    fileController.title = @"Home";
    [self.navigationController pushViewController:fileController animated:YES];
    
    NSLog(@"subPath:%@", subPaths);
}



- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
}


@end







